﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JMacia.Gaming.d20.Core.Traits
{
    public class ArmorClass : Trait
    {
        #region Private members
        #endregion

        #region Public static readonly fields
        public static readonly ModifierType[] StandardAllowedBonusTypes = new ModifierType[]{
            SystemModifierType.Alchemical,
            SystemModifierType.Armor,
            SystemModifierType.Circumstance,
            SystemModifierType.Competence,
            SystemModifierType.Deflection,
            SystemModifierType.Dodge,
            SystemModifierType.Insight,
            SystemModifierType.Luck,
            SystemModifierType.NaturalArmor,
            SystemModifierType.Profane,
            SystemModifierType.Sacred,
            SystemModifierType.Shield,
            SystemModifierType.Size,
            SystemModifierType.Untyped };
        public static readonly ModifierType[] StandardAllowedTouchBonusTypes = new ModifierType[]{
            SystemModifierType.Circumstance,
            SystemModifierType.Competence,
            SystemModifierType.Deflection,
            SystemModifierType.Dodge,
            SystemModifierType.Insight,
            SystemModifierType.Luck,
            SystemModifierType.Size,
            SystemModifierType.Untyped };
        #endregion

        #region Constructors
        public ArmorClass() : this(new Modifiers(), StandardAllowedBonusTypes) { }

        public ArmorClass(Modifiers modifiers) : this(modifiers, StandardAllowedBonusTypes) { }

        public ArmorClass(Modifiers modifiers, ModifierType[] allowedBonusTypes)
            : base("Armor Class", 10, modifiers, allowedBonusTypes)
        { }
        #endregion

        #region Public Properties
        public int TouchAC
        {
            get
            {
                List<ModifierType> holding = AllowedBonusTypes;
                AllowedBonusTypes = new List<ModifierType>(AllowedBonusTypes.Intersect(ArmorClass.StandardAllowedTouchBonusTypes));
                int val = Total;
                AllowedBonusTypes = holding;
                return val;
            }
        }
        #endregion

        #region Public Methods
        public override string ToString()
        {
            return base.ToString();
        }
        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        #endregion

        #region Public Static Methods
        
        #endregion
    }


}
